package com.vogue.supplymall.shop.domain.dao;

import com.vogue.supplymall.common.domain.dto.SearchInfo;
import com.vogue.supplymall.shop.domain.model.Product;
import com.vogue.supplymall.shop.domain.model.Shop;

import java.util.List;
import java.util.Map;

/**
 * The interface Product dao.
 *
 * @Aouthor: zhangliang
 * @Date: Create in 2017-12-05
 */
public interface ProductDao extends BaseDao<Product, Long> {

    /**
     * Find by id shop.
     *
     * @param id the id
     * @return the shop
     */
    Product findById(Long id);

    /**
     * Gets sql by id.
     *
     * @param id      the id
     * @param sysCode the sys code
     * @return the sql by id
     */
    StringBuilder getSqlById(Long id,Long sysCode);

    /**
     * Find product list.
     * 根据自定义sql检索商品
     *
     * @param searchInfo the search info
     * @return the list
     */
    List<Map<String, Object>> findProduct(SearchInfo searchInfo);

    /**
     * 根据自定义sql检索商品总数量
     * @param searchInfo
     * @return
     */
    Long findProductCount(SearchInfo searchInfo);

    /**
     * Find product unit list.
     * 根据条件检索商品详情的单位
     *
     * @param searchInfo the search info
     * @return the list
     */
    List<Map<String, Object>> findProductUnit(SearchInfo searchInfo);
    /**
     * Find shop for sql list.
     * 通过唯一注册号id,shopid和对应机构id，得到商品信息
     */
    List<Product> findProductBySSM(Long sysCodeId, Long shopId,List<String> matchIds);
    /**
     * 根据syscodeid和productids找到不禁用的商品id
     */
    public List<Map<String, Object>> getProductIdBySp(Long syscodeid,String produdctIds);
    /**
     * 根据syscodeid和productids更改商品的禁用标记
     */
    public int changeProductDisabledFlag(Long sysCodeId,String productIds,boolean disabledFlag);
    /**
     * 根据syscodeid和shopId找到该店铺下的所有商品
     */
    public List<Product> findProductBySS(Long sysCodeId,Long shopId);
    /**
     * 根据syscodeid和productids得到商品的默认单位数量和商品的id
     */
    public List<Map<String, Object>> findProductDUCBySP(Long sysCodeId,String productIds);
    /**
     * 根据syscodeid和productids更改商品的默认单位为最先上传的单位
     */
    public void changeNoUnitProductDU(Long sysCodeId,String productId);
    /**
     * 根据syscodeid和productids更改商品的默认单位为最新修改上传的单位
     */
    public void changeManyUnitProductDU(Long sysCodeId,String productId);
    /**
     * 用insert语句存储商品与客户的对应关系
     */
  //  public void saveProductCustomerRelation(String values);
    /**
     * 根据卖家注册号id删除商品与客户的对应关系
     */
    public void delProductCustomerRelation(Long sellsyscodeid);
    /**
     * 根据syscodeId和shopId找到所有的商品和商品对应的单位
     */
    public String getProductInfoBySS();


}
